1. Field of the Invention
The present invention relates to the field of data processing. More particularly, the invention relates to an apparatus and method for handling exception events.
2. Description of the Prior Art
While data processing is being carried out, an exception event may occur, indicating that the data processing should be interrupted so that an exception handling routine can be performed. Exception events can indicate, for example, that a processing result is undefined, that a processing resource has overflowed, or that an exception signal has been received from an external device. It is possible to process exception events in multiple exception states. Each exception state can have a different priority level and different resources associated with it.
It can be useful to provide each exception state with its own stack data store for storing temporary variables while processing an exception handling routine in the exception state. The stack data store is typically stored in a memory and is a first-in-first-out (FIFO) data structure. The stack data store has a predetermined amount of memory space allotted to it. If too much data is stored on the stack, then the stack may exceed its allocated memory space. The stack may overrun a page boundary and may not have the access rights for accessing the next page in memory, thus triggering a memory abort. Also, if the processor tries to store on the stack a variable that is larger than the remaining space in the stack, then this can cause an error. These kinds of errors are known as stack overflows. Generally, a stack overflow is any error associated with overuse of the stack that prevents a data value being stored on the stack.
Typically, one of the first tasks performed by an exception handling routine after an exception event is to push some variables onto a stack. It is therefore important that stack capacity is available to the exception handling routine on taking an exception, to ensure that the exception handling routine can be started successfully. If the stack overflows, then this could prevent the exception handling routine being executed properly, since the stack overflow may itself trigger an exception event which causes another exception handling routine to try to push variables onto the stack, causing another stack overflow exception event. This can result in an endless loop of exception events each trying to load variables onto the stack and each triggering a further exception event due to the stack overflow, and can cause the system to crash due to such recursive exception entry. The present technique seeks to reduce the likelihood of such crashes.